#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long clac(long long x)
{
	long long sum = 0;
	for(long long i = 1;i*i<=x;i++)
	{
		if(x%i==0)
		{
			sum += i;
			if(i!=x/i) sum += (x/i);
		}
	}
	return sum;
}
int main()
{
	long long n;
	while(scanf("%I64d",&n)&&n!=0)
	{
		long long ans = clac(n);
		printf("%I64d\n",ans);
	}
}
